home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / clipper / cgwrka10.zip / APL.A next >
Text File  |  1994-02-24  |  45KB  |  1,289 lines

  1. ***************************************************************** 
  2.     U S E   O F    L I B R A R Y cg_work 1.0
  3.     March 1994, Bostjan Debeljak
  4. ***************************************************************** 
  5.  
  6.   
  7. 1.  SHORT DESCRIPTION
  8.  
  9. This is the library for creating applications in Clipper with no programing.
  10. It includes functions on database (query, insert, update, delete, etc), user
  11. functions on database, user functions before and after functions on database,
  12. help, multi table transparency on screen, user input control, etc.
  13. User must call just two (2) commands from the library for all this functions.
  14.  
  15. Demo program is also with this library. For your immediate work and for
  16. your estimation of this library I recommend you next steps:
  17.     - Compile demo program (command "rmake demo").
  18.     - Execute demo program and check library functionality.
  19.     - See teh demo source file ('demo.prg'). Ragarding its smallness you
  20.       will see the functionality of the library and its ease of use.
  21.  
  22. 2.  INTRODUCTION
  23.  
  24. Nowadays every user of PC need or use same data base. This is usually very
  25. specific for each person.
  26.  
  27. This library is intended for users who need data base and know how to
  28. program in Clipper and also for those who don't know anything about programing.
  29.  
  30. Purpose of this library is prototyping, but it can be also
  31. used for complete applications. Applications create with use of this 
  32. library have all functionality needed for work with data base.
  33.  
  34. It is necessary to have Clipper compiler for creation of applications
  35. with this library.
  36.  
  37. Syntax is very simple for use and doesn't demand programing skills.
  38. Programer must only know how to make database (for example with DBU,
  39. which already exists in Clipper).
  40. Fast changes are possible without compiling.
  41.  
  42. Library includes all functions (system functions) necessary for
  43. application on database. This functions are available in applications
  44. without any programing:
  45.  
  46.     - query;
  47.     - add;
  48.     - update;
  49.     - delete;
  50.     - line display;
  51.     - output;
  52.     - etc;
  53.  
  54. User can add his/her functions on database at the same level as are system
  55. functions.
  56.  
  57. User define functions can be called before and after each of this system
  58. functions on database.
  59.  
  60. Such functions can be for user define outputs (header,..), colors, controls,
  61. etc. Programer must write this functions and include them in the application.
  62. The library then take care for their execution at the right time.
  63.  
  64. Data from different tables can be transparently displayed on the screen at the
  65. same time (which data belongs to some table isn't visible).
  66. User define functions can be called also before window display. So the
  67. screen can be completely user defined.
  68.  
  69. Two (or more) different records from same table can be displayed in one
  70. window.
  71.  
  72. Messages for help can exist for whole window or for each field in the window.
  73.  
  74. Fields in screen have a lot of attributes, which can be changed by programer,
  75. without recompiling or relinking of the application (display format, default
  76. values, user controlled insertion in the fields, etc).
  77.  
  78. Programer must write all this attribute in an ascii file - specifications.
  79. Only the list of the tables, fields from the tables which will be displayed
  80. on the screen, their location on the screen and links between tables must
  81. be in that file. Two functions (cg_init, cg_work) from the library, which
  82. reads the specifications, must be called from the application.
  83. So the whole application can be done in 15 minutes. This approach is
  84. very useful for prototyping. There exist also a lot of other attributes
  85. and possibilities with which complex application can be created. This
  86. demands also some (but very little) programing.
  87.  
  88.  
  89. 3.  PROCEEDINGS
  90.  
  91. A. Creation of tables and indexes (for example with DBU). For index creation
  92. see item 6.4.
  93.  
  94. B. Creation of specifications (see item 6). Specifications for demo example
  95. are in file "INP_DEMO". Next rules are enough for creation of basic
  96. specifications:
  97.  
  98.     - insert window name;
  99.     - insert names of all areas;
  100.     - insert data for areas: tables, fields and connections.
  101.  
  102. C. Creation of user application with library commands.
  103.  
  104.     - insert absolute data base path in variable 'db_path' (see item 7.3).
  105.     - initialisation of library variables with command 'cg_init()'.
  106.     - execution of command 'cg_work', which allows all library
  107.      functionality.
  108.  
  109. This document describes all the functionality of the library . But just 
  110. items 5 and 6 are enough for the start. And also some points in this two
  111. items are unnecessary for the start.
  112.  
  113. Demo is also included with this library and is a good help to show the use
  114. of the library.
  115.  
  116.  
  117. 4.  DICTIONARY
  118.  
  119. table -  work area;
  120. record -  one line of data in one table in the database;
  121. field - area in screen (in window) for display of one data (e.g. number,
  122.     string);
  123. element -  records from all tables currently displayed on screen;
  124. programer - person, who use this library for creation of the applications;
  125. user - person, who uses this applications.
  126.  
  127. Of course can programer and user be the same person.
  128.  
  129.  
  130. 5.  LIBRARY COMMANDS
  131.  
  132. Programer can use in his/her applications some commands from library.
  133.  
  134. There are (just!!) four commands available:
  135.  
  136. 5.1  cg_init 
  137.  
  138. Initialize user functions and some variables. It must be called before
  139. first 'cg_work' command. It should be placed at the beginning of the
  140. applications.
  141.  
  142. Syntax:
  143.  
  144.     cg_init() 
  145.  
  146. Variable 'db_path' must be set before this command (see item 7.3).
  147.  
  148. 5.2  cg_work 
  149.  
  150. Windows, tables with their fields, attributes, etc are described in input
  151. file - specifications.
  152.  
  153. This command search desired window name in specifications, read data and
  154. displays window on screen. It also allows execution of system and user
  155. functions.
  156.  
  157. Syntax:
  158.  
  159.     cg_work("f_name", "w_name", l_x, u_y, r_x, b_y) 
  160.  
  161. Parameters are:
  162.  
  163.     f_name -  input file name, specifications;
  164.     w_name -  window name from specifications;
  165.     l_x - left x  window coordinate;
  166.     u_y - upper y window coordinate;
  167.     r_x - right x window coordinate;
  168.     b_y - bottom y window coordinate.
  169.  
  170.  
  171. If the window is bigger than the size of the screen or coordinate data
  172. doesn't exists, there exist default data for window. This are:
  173.  
  174.     0 - for left x coordinate;
  175.     0 - for upper y coordinate;
  176.     Maxcol() - for right x coordinate;
  177.     Maxrow()-1 - for bottom y coordinate;
  178.  
  179. 5.3  next_el 
  180.  
  181. This command searches for next element in tables. Return value is '.t.' if
  182. element was found else value '.f.' is returned.
  183.  
  184. This command doesn't show the element.
  185.  
  186. Syntax:
  187.  
  188.     next_el() 
  189.  
  190. 5.4  previous_el 
  191.  
  192. This command searches for previous element in tables. Return value is '.t.' if
  193. element was found else value '.f.' is returned.
  194.  
  195. This command doesn't show the element.
  196.  
  197. Syntax:
  198.  
  199.     previous_el() 
  200.  
  201. ------- 
  202. Programer can use last two commands in user functions for searching next
  203. or previous element without displaying it.
  204.  
  205. All errors and warnings are displayed in the bottom line on the screen. They are
  206. shown for 5 sec. User can delete this line before 5 sec is over and
  207. continue with work, by pressing any button.
  208.  
  209. Some commands which are part of Clipper library are already linked in this
  210. library. This are:
  211.  
  212.  
  213.  error_msg() 
  214.  
  215. Displays comment, given as parameter, in last row on the screen.
  216.  
  217.  error_off() 
  218.  
  219. Delete the bottom line on the screen.
  220.  
  221.  rsvp() 
  222.  
  223. Displays question, given as parameter, in the bottom line on the screen.
  224. Possible answer is 'Y' or 'N'. Answer is returned by the command.
  225.  
  226.  ListAsArray() 
  227.  
  228. First parameter of this command is string, second one is delimiter. Command
  229. returns array of strings which are between delimiters in the parameter
  230. string. Example: "ab,cd,ef" -> command returns array of strings with size
  231. 3: [1]="ab; [2]="cd"; [3]="ef".
  232.  
  233. Program distinguishes between upper and lower letters.
  234.  
  235.  
  236. 6.  SPECIFICATIONS
  237.  
  238. Commands in the library read data from input file - specifications.
  239. Specifications can have data for one or more windows. Each window starts with
  240. label "WINDOW" folloved by window name, which is used in command 'cg_work'.
  241.  
  242. Window can be just on the screen (n